<%
   unless action_plan.totalIssues()==0
     project = @project
     project = @resource if project.nil?
     options = {:actionPlans => action_plan.key, :componentRoots => u(project.key)}

     resolved_issues_link = action_plan.resolvedIssues().to_s
     resolved_issues_link = link_to action_plan.resolvedIssues().to_s, url_for_issues(options.merge(:resolved => 'true')) unless action_plan.resolvedIssues()==0
     total_issues_link = link_to action_plan.totalIssues().to_s, url_for_issues(options)

     if action_plan.resolvedIssues() > 0
       resolved_issues_url = url_for_issues(options.merge({:resolved => 'true'}))
       percent_resolved = (action_plan.resolvedIssues()*100 / action_plan.totalIssues()).to_i
       tooltip_resolved = message('action_plans.resolved_issues_x_percent', :params => [percent_resolved.to_s, action_plan.resolvedIssues().to_s])
     end

     if action_plan.unresolvedIssues() > 0
       unresolved_issues_url = url_for_issues(options.merge({:resolved => 'false'}))
       percent_open = (action_plan.unresolvedIssues()*100 / action_plan.totalIssues()).to_i
       tooltip_open = message('action_plans.unresolved_issues_x_percent', :params => [percent_open.to_s, action_plan.unresolvedIssues().to_s])
     end
%>

  <div class="progress">
    <table>
      <tbody>
      <tr>
        <% if action_plan.resolvedIssues() > 0 %>
          <td class="resolved" style="width:<%= percent_resolved -%>%;">
            <a href="<%= resolved_issues_url -%>" title="<%= resolved_issues_url -%>" alt="<%= tooltip_resolved -%>"></a>
          </td>
        <% end %>
        <% if action_plan.unresolvedIssues() > 0 %>
          <td class="open" style="width:<%= percent_open -%>%;">
            <a href="<%= unresolved_issues_url -%>" title="<%= unresolved_issues_url -%>" alt="<%= tooltip_open -%>"></a>
          </td>
        <% end %>
      </tr>
      </tbody>
    </table>
    <div class="note"><%= message('action_plans.x_out_of_x_issues_solved', :params => [resolved_issues_link, total_issues_link]) -%></div>
  </div>

<% end %>
